# Import the base Model class from Flask-AppBuilder.
from flask_appbuilder import Model
# Import column types from SQLAlchemy to define database schema.
from sqlalchemy import Column, Integer, String, Text

# Import custom base models and mixins from the application.
from myapp.models.base import MyappModelBase
from myapp.models.helpers import AuditMixinNullable


# Define the TuningExample class, which maps to the 'tuning_example' table in the database.
# It inherits from Flask-AppBuilder's Model, our custom AuditMixin, and a base model.
class TuningExample(Model, AuditMixinNullable, MyappModelBase):
    # Specify the table name in the database.
    __tablename__ = 'tuning_example'
    # Define the primary key column for the table.
    id = Column(Integer, primary_key=True, comment='id')
    # The name of the tuning example.
    name = Column(String(200), nullable=True, comment='案例名称')
    # A URL or path to an image that visually represents the example.
    image = Column(String(200), nullable=True, comment='案例图片展示')
    # A label indicating the difficulty or level of the tuning example.
    rank_label = Column(String(200), nullable=True, comment='优化案例等级')
    # A label for the category of the tuning example (e.g., performance, accuracy).
    category_label = Column(String(200), nullable=True, comment='优化案例类型')
    # A short description of the tuning example.
    description = Column(String(200), nullable=True, comment='优化案例描述')
    # A detailed overview of the tuning example, stored as text.
    example_overview = Column(Text, nullable=True, comment='案例概览')
    # A guide or instructions on how to configure and run the example, stored as text.
    configuration_guide = Column(Text, nullable=True, comment='配置指引')
    # The default parameters for the tuning task, stored as a JSON string in a text field.
    default_params = Column(Text, nullable=True, comment='任务默认参数')
